package com.bj58.ecdata.calc.dbservice.dao;

import java.util.Collections;
import java.util.Set;

import org.springframework.stereotype.Component;

import redis.clients.jedis.Tuple;

import com.bj58.ecdata.calc.dbservice.dao.model.SearchWord;
import com.bj58.ecdata.exception.BusinessException;

/**
 * @author lichao
 *
 */
@Component
public class SearchWordDao extends BaseDao<SearchWord> {
	@Override
	public void save(SearchWord model) {
		try {
			this.cache_insert(model);
		} catch (Exception e) {
			throw new BusinessException(e);
		}
	}

	public Set<Tuple> loadSearchWordList(SearchWord model, int count) {
		try {
			Set<Tuple> result = super.cacheLoadsDailyZset("searchWord", model, 0, count - 1);
			if (result != null)
				return result;
			else
				return Collections.emptySet();
		} catch (Exception e) {
			throw new BusinessException(e);
		}
	}

	@Override
	protected String getCreateSQL() {
		return null;
	}
}
